#include "logcplus.h"

#include <fstream>
using namespace std;

int logcplus_properties_test(const string& iLoggerName,logcplus_properties& logProperty)
{
    logcplus_params logParam;
    logProperty.getParams(iLoggerName,logParam);
    std::cout<<"+++++++++get logcplus_properties "<<iLoggerName<<" start ++++++"<<endl;
    std::cout<<"_logname["<<logParam._logname<<"]"<<std::endl;
    std::cout<<"_level["<<logParam._level<<"]"<<std::endl;
    std::cout<<"_appender_ref["<<logParam._logType<<"]"<<std::endl;
    std::cout<<"_maxBackupIndex["<<logParam._maxBackupIndex<<"]"<<std::endl;
    std::cout<<"_maxFileSize["<<logParam._maxFileSize<<"]"<<std::endl;
    std::cout<<"_conversionPattern["<<logParam._conversionPattern<<"]"<<std::endl;
    std::cout<<"_bufferLevel["<<logParam._bufferLevel<<"]"<<std::endl;
    std::cout<<"_saveDays["<<logParam. _saveDays<<"]"<<std::endl;
    std::cout<<"+++++++++get logcplus_properties "<<iLoggerName<<" end ++++++"<<endl;
    std::cout<<std::endl;
	return 0;
}

int ofstream_test()
{

    //ofstream fs("/home/aips/log/ofstream.log",ofstream::out | ofstream::app);
    //fs << "123123";
    //fs << "453456";
    //fs.flush();

    SINFO("1111111111111111");
    SINFO("2222222222222222");
    SINFO("3333333333333333");
    SINFO("4444444444444444");

    while(1)
    {
        sleep(100);
    }
}

int main()
{
    ofstream_test();

    logcplus_properties properties;

    char sPropfile[128]= {0};
    sprintf(sPropfile,"%s/etc/%s",getenv("HOME"),LOGCPLUS_PROPERTIES_FILE);
    properties.initProperties(sPropfile);
    properties.loadProperties();

    return logcplus_properties_test("oltpbizswt",properties);
}